Point p {
      shape = None
      -- TODO: add an "anchor point" object class? (has an internal shape that isn't displayed)
}

Set `domainOuter` {
    shape = Arrow {
    -- TODO: writing "start = 5" isn't treated as fixed constants, but a computation sort of is
          start = atOrigin()
    end = toRight()
          text = "x"
    }

    objective nearHead(domainOuter, domainOuter.shape.label, 15, 0) -- formerly domainOuter.label
}

Set `codomain` {
    shape = Arrow {
          start = atOrigin()
          end = toAbove()
          text = "f(x)"
    }

    objective nearHead(codomain, codomain.shape.label, 0, 20) -- TODO parse negative numbers
}

Bijection f domain image {
    shape = Curve {
          path = computeBijectionLines(5, domain, image)
          text = "(Bijection)"
    color = darkBlue()
    }
    
    objective sameX(domainOuter.shape, f.shape.label, 30)
    objective above(domainOuter.shape, f.shape.label, 30)
}

-- Set `domainOuter`, Set `codomain` {
Set `cartesianProduct` {
  shape = Rect {
    text = None
    center = regionCenter(domain, image)    -- this will pass in both of domain's objects
    length = regionX(domain)
    width = regionY(image)
    color = lightBlue()
  }
}

Set `domain` {
       left = Line {
             style = "dashed"
             path = lineLeft(0.2, domainOuter, codomain)
             text = "A0"
       }

       right = Line {
              style = "dashed"
              path = lineLeft(0.8, domainOuter, codomain)
              text = "A1"
       }

       -- TODO here, 'domain' should be in scope, so we should only have to type 'left' or 'right'
       -- TODO need to check for name clashes/scope between Sub/Sty/Sty blocks
       objective nearEndVert(domain.left, domain.left.label)
       objective nearEndVert(domain.right, domain.right.label)
}

Set `image` {
       bottom = Line {
             style = "dashed"
             path = lineRight(0.2, codomain, domainOuter)
             text = "B0"
       }

       top = Line {
              style = "dashed"
              path = lineRight(0.8, codomain, domainOuter)
              text = "B1"
       }

       objective nearEndHoriz(image.bottom, image.bottom.label)
       objective nearEndHoriz(image.top, image.top.label)
}
